package edu.rmit.service;

import java.rmi.RemoteException;

/**
 * This interface defines the chat operation. Which can implement register a
 * user to the group chat, remove a user from group chat, and send chat message,
 * send forum message, and remove forum message.
 * 
 * @author Joey George
 * @version 1.0
 */
public interface IChatService extends IServerService {

	public final static int SUCCESS = 0;
	public final static int ERR_GROUP_ID = 1;
	public final static int QUIT = 2;
	public final static int CHAT_MSG = 3;
	public final static int FORUM_MSG = 4;
	public final static int DELETE_FORUM_MSG = 5;
	public final static int JOIN = 6;
	public final static int SYSTEM_IFNO = 7;

	public final static String SERVER = "";
	
	/**
	 * This method defines the operation to add a user to a particular group to
	 * chat.
	 * 
	 * @param groupId
	 *            The group id which the user want to participant.
	 * @param userName
	 *            The user name of the participant
	 * @param callBackService
	 *            The callback service which can implement to add the message to
	 *            the corresponding control
	 * @return The status whether the user is successfully attended.
	 * @throws RemoteException
	 */
	public int addChatListener(int groupId, String userName,
			IChatCallBackService callBackService) throws RemoteException;

	/**
	 * This method defines the operation to remove a user to a particular group
	 * to chat.
	 * 
	 * @param groupId
	 *            The group id which the user want to leave.
	 * @param userName
	 *            The user name of the leave person.
	 * @param reason
	 *            The reason message.
	 * @throws RemoteException
	 */
	public void removeChatListener(int groupId, String userName, String reason)
			throws RemoteException;

	/**
	 * This method defines the operation to remove an forum message
	 * 
	 * @param groupId
	 *            The group id which the forum message is belongs to.
	 * @param sender
	 *            The sender name which this forum message is been send.
	 * @param messageId
	 *            The message id which you want to delete.
	 * @throws RemoteException
	 */
	public void removeForumMessage(int groupId, String sender, int messageId)
			throws RemoteException;

	/**
	 * This method defines the operation to send an chat message
	 * 
	 * @param groupId
	 *            The group id which the chat message is belongs to.
	 * @param sender
	 *            The sender name which this chat message is been send.
	 * @param message
	 *            The message  which you want to send.
	 * @throws RemoteException
	 */
	public void sendChatMessage(int groupId, String sender, String message)
			throws RemoteException;

	/**
	 * This method defines the operation to send an forum message
	 * 
	 * @param groupId
	 *            The group id which the forum message is belongs to.
	 * @param sender
	 *            The sender name which this forum message is been send.
	 * @param message
	 *            The message which you want to send.
	 * @throws RemoteException
	 */
	public void sendForumMessage(int groupId, String sender, String message)
			throws RemoteException;
}
